package org.kfive.nova.io.grizzly.echo;

import org.glassfish.grizzly.filterchain.BaseFilter;
import org.glassfish.grizzly.filterchain.FilterChainContext;
import org.glassfish.grizzly.filterchain.NextAction;

import java.io.IOException;

/**
 * TODO
 *
 * @author zhanwu.lzw
 * @date 2018年01月25日 14:40
 */
public class ClientFilter extends BaseFilter {

    /**
     * {@inheritDoc}
     *
     * @param ctx
     */
    @Override
    public NextAction handleRead(FilterChainContext ctx) throws IOException {

        final String serverResponse = ctx.getMessage();

        System.out.println("Server echo:"+serverResponse);

        return ctx.getStopAction();
    }
}
